def file = new File(context.getRealPath(request.getParameter("filename")))

if (!(file && file.delete()) || file.createNewFile())  {
	file << request.getParameter("contents")
}

println "{success : true, fileinfo : {filetype : 'groovy', lastmod : '${new Date(file.lastModified())}', size : ${file.length()} }}"